package cn.funeralobjects.upms.api;

import cn.funeralobjects.common.web.api.CommonCloudRestApi;
import cn.funeralobjects.common.web.api.CommonTreeCrudRestApi;
import cn.funeralobjects.upm.web.model.MGroup;
import cn.funeralobjects.upm.web.model.VGroup;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import reactor.core.publisher.Mono;

import javax.validation.constraints.NotEmpty;

/**
 * 组API
 *
 * @author FuneralObjects
 * Create date: 2020/4/30 4:57 PM
 */
@Validated
public interface GroupApi extends CommonCloudRestApi<VGroup, Integer>, CommonTreeCrudRestApi<VGroup, MGroup, Integer> {

    /**
     * 添加组标签
     *
     * @param id  组id
     * @param tag 组标签
     * @return 无返回
     */
    @PostMapping("/{id}/tag")
    Mono<Void> addGroupTag(@PathVariable Integer id, @NotEmpty @RequestParam String tag);

    /**
     * 移除组标签
     *
     * @param id  组id
     * @param tag 组标签
     * @return 无返回
     */
    @DeleteMapping("/{id}/tag/{tag}")
    Mono<Void> removeGroupTag(@PathVariable Integer id, @PathVariable String tag);
}
